﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace Ecommerce.Areas.Manager.Models
{
    public class Category
    {
        public int CategoryID { get; set; }

        [Required(ErrorMessage = "Category name is required")]
        [StringLength(100, ErrorMessage = "Max length of category name is 100")]
        [Display(Name = "Category Name")]
        public string CategoryName { get; set; }

        [Required(ErrorMessage = "Sort Order is required")]
        [Range(0, 10, ErrorMessage = "Sort order is [0-10]")]
        [Display(Name = "Sort Order")]
        public int Order { get; set; }

        public int Products { get; set; }

        public DateTime? LastUpdate { get; set; }

        public Category()
        {
            this.Order = 0;
        }

        public virtual List<Product> ProductList { get; set; }

    }
}